#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
mars录屏 - 主程序入口
"""

import sys
import os
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QIcon

from modules.app import ScreenRecorderApp
from modules.utils import check_dependencies, resource_path

def main():
    """主函数"""
    # 检查依赖包
    check_dependencies()
    
    # 设置高DPI支持
    QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
    QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True)
    
    app = QApplication(sys.argv)
    app.setStyle("Fusion")  # 使用Fusion风格，在所有平台上看起来更一致
    
    # 设置应用信息
    app.setApplicationName("mars录屏")
    app.setApplicationVersion("1.1.0")
    
    # 设置应用图标
    icon_path = resource_path("resources/icons/app_icon.png")
    if os.path.exists(icon_path):
        app.setWindowIcon(QIcon(icon_path))
    
    # 创建并显示主窗口
    window = ScreenRecorderApp()
    window.show()
    
    sys.exit(app.exec_())

if __name__ == "__main__":
    main()